package com.atguigu.redisdemo;

import redis.clients.jedis.Client;
import redis.clients.jedis.Connection;
import redis.clients.jedis.Jedis;

public class RedisDemo {
    public static void main(String[] args) {
        //1.创建redis客户端并连接redis服务主机和端口
        Jedis jedis = new Jedis("hadoop102", 6379);
        //2.如果redis服务器有密码输入密码
        //jedis.auth("123321");
        //3.进行操作
        System.out.println(jedis.ping());
        System.out.println(jedis.get("k1"));
        jedis.set("k123","123");
        System.out.println(jedis.get("k123"));
        //4.关闭连接
        jedis.close();
    }
}
